<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>设置新密码 - 马蜂窝</title>
    <meta property="mfw:partner-platform" content="">
    <link href="https://css.mafengwo.net/css/cv/css+login+login_v2:mobile+css+omc+login-omc+login-omc^ZlY^1574732649.css" rel="stylesheet" type="text/css"/>
    <link href="/js/plugins/bootstrapvalidator-master/dist/css/bootstrapValidator.min.css">
    <script type="text/javascript" src="/js/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/js/plugins/jquery-form/jquery.form.js"></script>
    <script type="text/javascript" src="/js/system/common.js"></script>
    <script type="text/javascript" src="/js/plugins/jquery-bootstrap/jquery.bootstrap.min.js"></script>
    <script type="text/javascript" src="/js/plugins/bootstrapvalidator-master/dist/js/bootstrapValidator.js"></script>
    <script>
        $(function () {
            //短信发送
            $('.vcode-send').click(function () {
                var phone = $('#phone').val();
                console.log(phone);
                if ($(this).hasClass('disabled')) {
                } else {
                    var self = $(this);
                    var count = 10;
                    self.addClass('disabled');
                    self.text(count + '秒后重新获取');
                    var timer = setInterval(function () {
                        count--;
                        if (count > 0) {
                            self.text(count + '秒后重新获取');
                        } else {
                            clearInterval(timer);
                            self.text('重新获取验证码');
                            self.removeClass("disabled");
                        }
                    }, 1000);
                    $.get("/mine/sendVerificode",{"phone":phone},function (data) {
                        console.log(data);
                        if(data.success){
                            alert("发送成功");
                        }else{
                            alert(data.msg);
                        }
                    })
                }
            });
            //提交密码表单
            $('#_js_submit').click(function () {
                $('#_j_reset_password_form').ajaxSubmit(function (data) {
                    console.log(data);
                    if(data.success){
                        alert(data.msg);
                        location.href = "/login.html";
                    }else {
                        alert(data.msg);
                    }

                })
            })
            //表单数据验证
            $("#_j_reset_password_form").bootstrapValidator({
                message: 'This value is not valid',
                submitButtons: 'button[type="submit"]',
                live: 'enabled',
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {
                    password: {
                        validators: {
                            notEmpty: {
                                message: '密码不能为空！'
                            },
                            stringLength: {
                                min: 6,
                                max: 12,
                                message: '密码长度 %s ~ %s 个字符！'
                            }
                        }
                    },
                    rpassword: {
                        validators: {
                            notEmpty: {
                                message: '确认密码不能为空！'
                            },
                            identical: { // 比较是否相同，否的话校验不通过
                                field: 'password', // 和 password 字段比较
                                message: '两次输入密码不一致！'
                            }
                        }
                    },
                    verifyCode: { // name 属性值
                        validators: {
                            notEmpty: { // 非空校验
                                message: '验证码不能为空!'
                            },
                            stringLength: { // 长度校验
                                min: 3,
                                max: 10,
                                message: '用户名长度 %s ~ %s 个字符！'
                            }
                        }
                    }
                }
            })
        })



    </script>
</head>
<body>

<div class="wrapper form-wrapper">
    <div class="container">
        <a href="http://www.mafengwo.cn" title="返回首页" class="logo">马蜂窝</a>
        <div class="form-box">
            <div class="form-info ">
                <div class="form-title">设置新密码</div>
                <form action="/mine/setNewPassword" method="post" id="_j_reset_password_form">
                    <div class="form-list" id="_js_resetForm">
                        <div class="form-item form-group form-item-first">
                            <input type="hidden" name="phone" id="phone" value="${userInfo.phone}">
                            <input class="form-control" name="password" type="password" placeholder="请输入密码" autocomplete="off" />
                            <div class="grade">
                                <span class="b1"></span>
                                <span class="b2"></span>
                                <span class="b3"></span>
                            </div>
                        </div>
                        <div class="form-item form-group" >
                            <input class="form-control" name="rpassword" type="password" placeholder="请再次输入密码" autocomplete="off" />
                        </div>
                        <div class="form-item form-group">
                            <a href="#" class="vcode-send sms-code-send">获取验证码</a>
                            <input class="form-control" name="verifyCode" id="verifyCode" type="text" placeholder="短信验证码" autocomplete="off"class="vcode-input">
                        </div>
                        <div class="form-submit">
                            <a id="_js_submit">完成</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    window.isPC = true;
</script>
<img src="https://images.mafengwo.net/images/signup/wallpaper/25.jpg&#10;" style="height: 943px; width: auto;">

</body>
</html>